package cn.java86.test;

import cn.java86.util.MybatisUtil;
import cn.java86.dao.SubjectDao;
import cn.java86.entity.Subject;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class AddSubject {
    public static void main(String[] args) {
        SqlSession s = MybatisUtil.get();
        Subject sub=new Subject();
        sub.setSubjectname("如何设置win10默认为杨文");
        sub.setClasshour(1000);
        sub.setGradeid(7L);
        SubjectDao mapper = s.getMapper(SubjectDao.class);
        int r=mapper.add(sub);
        System.out.println("增加后：id="+sub.getId());
        s.commit();
        MybatisUtil.close(s);
    }
}
